<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="description" content="%description%" />
    <meta name="keywords" content="" />
    <meta name="author" content="ComponentOne" />
    <link href="../../themes/rocket/jquery-wijmo.css" rel="stylesheet" type="text/css" />
    <script src="../../external/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="../../external/jquery-ui-1.9.1.custom.min.js" type="text/javascript"></script>
    <script src="../../external/raphael-min.js" type="text/javascript"></script>
    <script src="../../wijmo/jquery.wijmo.raphael.js" type="text/javascript"></script>
    <script src="../../wijmo/jquery.wijmo.wijgauge.js" type="text/javascript"></script>
    <script src="../../wijmo/jquery.wijmo.wijradialgauge.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#gauge").wijradialgauge({
                value: 100,
                max: 150,
                min: 0,
                startAngle: -45,
                sweepAngle: 270,
                radius: 170,
                origin: {
                    x: 0.5, y: 0.5
                },
                labels: {
                    offset: -30, 
                    style: {
                        fill: "#556A7C",
                        stroke: "#556A7C"
                    }
                },
                tickMinor: {
                    position: "inside",
                    style: {
                        fill: "#556A7C",
                        stroke: "#556A7C"
                    },
                    interval: 2,
                    visible: true,
                    offset: 0
                },
                tickMajor: {
                    position: "center",
                    style: {
                        fill: "#556A7C",
                        stroke: "#556A7C"
                    },
                    interval: 10,
                    visible: true,
                    marker: function (canvas, startLocation) {
                        return dawnMark(canvas, startLocation);
                    }
                },
                ranges: [{
                    startWidth: 20,
                    endWidth: 20,
                    startValue: 20,
                    endValue: 50,
                    startDistance: 0.65,
                    endDistance: 0.65,
                    style: {
                        fill: "#BC8A8E",
                        stroke: "#BC8A8E"
                    }
                },
                {
                    startWidth: 20,
                    endWidth: 20,
                    startValue: 100,
                    endValue: 130,
                    startDistance: 0.65,
                    endDistance: 0.65,
                    style: {
                        fill: "#58A85E",
                        stroke: "#58A85E"
                    }
                }
                ],
                face: {
                    style: {},
                    template: function (ui) {
                        var url = "http://cdn.wijmo.com/images/gaugeFace.png";
                         return ui.canvas.image(url, ui.origin.x - ui.r, ui.origin.y - ui.r, ui.r * 2, ui.r * 2);
                    }
                },
                pointer: {
                    length: 1,
                    style: {
                        fill: "#BF551C",
                        stroke: "#BF551C"
                    },
                    template: function (startLocation, pointerInfo) {
                        return dawnArrow(this, startLocation, pointerInfo);
                    }
                },
                cap: {
                    behindPointer: false,
                    style: {
                        fill: "#6DC5D8",
                        stroke: "#6DC5D8"
                    }
                }
            });

            function dawnMark(canvas, startLocation) {
                var x = startLocation.x, mark,
                y = startLocation.y,
                x1 = x,
                y1 = y + 2,
                x2 = x + 7,
                y2 = y + 2,
                x3 = x + 9,
                y3 = y,
                x4 = x + 7,
                y4 = y - 2,
                x5 = x,
                y5 = y - 2,
                arrPath = ["M", x1, y1, "L", x2, y2, "L", x3, y3, "L", x4, y4, "L", x5, y5, "z"];
                mark = canvas.path(arrPath.concat(" "));
                mark.attr({
                    fill: "#6DC5D8",
                    stroke: "#6DC5D8"
                });
                return mark;

            }

            function dawnArrow(canvas, startLocation, pointerInfo) {
                var x = startLocation.x, arrow,
                y = startLocation.y,
                height = pointerInfo.width,
                width = pointerInfo.length,
                x1 = x,
                y1 = y + height / 2,
                x2 = x + 15,
                y2 = y - 10,
                x3 = x + 15,
                y3 = y,
                x4 = x + width,
                y4 = y,
                x5 = x + width,
                y5 = y + height,
                x6 = x + 15,
                y6 = y + height,
                x7 = x + 15,
                y7 = y + height + 10,
                arrPath = ["M", x1, y1, "L", x2, y2, "L", x3, y3, "L", x4, y4, "L", x5, y5, "L", x6, y6, "L", x7, y7, "z"];
                arrow = canvas.path(arrPath.concat(" "));
                arrow.attr({
                    fill: "#6DC5D8",
                    stroke: "#6DC5D8"
                });
                return arrow;
            }

            $("#btnExec").click(function () {
                eval($("#code").val());
            })
        });
    
    </script>
</head>
<body class="demo-single">
    <div class="container">
        <div class="header">
            <h2>
                Template</h2>
        </div>
        <div class="main demo">
            <!-- Begin demo markup -->
            <div id="gauge">
            </div>
            <!-- End demo markup -->
            <div class="demo-options">
                <!-- Begin options markup -->
                <!-- End options markup -->
            </div>
        </div>
        <div class="footer demo-description">
            <p>This sample shows how to use <b>template</b> option.</p>
        </div>
    </div>
</body>
</html>
